package com.example.lp.basemvp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.example.lp.basemvp.annotation.InjectPresenter;
import com.example.lp.basemvp.baseview.IStartView;
import com.example.lp.basemvp.bean.Start;
import com.example.lp.basemvp.model.StartModel;
import com.example.lp.basemvp.presebter.StartPresenter;
import com.example.lp.lpmvp.R;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

public class MvpActivity extends BaseMvpActivity<StartPresenter, IStartView> implements IStartView {

    private static final String TAG = "MvpActivity";

    private TextView tv_show;

    @InjectPresenter
    StartPresenter presenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mvp);
        tv_show = findViewById(R.id.tv_show);
        presenter.refresh();


    }


    @Override
    public void showData(List<Start> data) {
        String toString = Arrays.toString(data.toArray());
        Log.i(TAG, "showData: " + toString);
        tv_show.setText(toString);
    }

    @Override
    public void showError(String error) {
        Log.i(TAG, "showError: ");
    }

}